#! /bin/sh /usr/share/dpatch/dpatch-run
## 30_new_openAL.dpatch by Mike Furr <mfurr@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
Index: chromium-0.9.12/src/AudioOpenAL.cpp
===================================================================
--- chromium-0.9.12.orig/src/AudioOpenAL.cpp	2007-04-06 22:26:45.000000000 +0200
+++ chromium-0.9.12/src/AudioOpenAL.cpp	2007-04-06 22:26:45.000000000 +0200
@@ -52,8 +52,8 @@
 	//try to use OpenAL alc[GS]etAudioChannel extensions in linux...
 	#ifdef __linux__ 
 		#define CD_VOLUME 1
-//		#include <AL/alext.h>
-		#include <AL/alexttypes.h>
+		#include <AL/alext.h>
+//		#include <AL/alexttypes.h>
 	#endif //__linux__
 #endif //USE_SDL
 #endif
@@ -472,6 +472,7 @@
 	ALsizei size, freq;
 	ALenum format;
 	ALvoid *data;
+	ALboolean loop;
 
 	for(i = 0; i < NumSoundTypes; i++)
 	{
@@ -482,9 +483,9 @@
 		else
 		{
 #ifndef _WIN32
-			alutLoadWAV(dataLoc(fileNames[i]), &data, &format, &size, &bits, &freq);
+			alutLoadWAVFile(const_cast<ALbyte*>(dataLoc(fileNames[i])), &format, &data, &size, &freq, &loop);
 			alBufferData (buffer[i], format, data, size, freq);
-			free(data);
+			alutUnloadWAV(format,data,size,freq);
 #else //_WIN32
 			char nameBuffer[256];
 			sprintf(nameBuffer, "%s", dataLoc(fileNames[i]));
@@ -844,14 +845,16 @@
 	return false;
 #else //USE_PLAYLIST
 	bool retVal;
-	ALsizei size, freq, bits;
+	ALsizei size, freq;
 	ALenum format;
 	ALvoid *data;
-	retVal = alutLoadWAV(filename, &data, &format, &size, &bits, &freq);
+	ALboolean loop;
+	alutLoadWAVFile(const_cast<ALbyte*>(filename), &format, &data, &size, &freq, &loop);
+	retVal = (alGetError() == AL_NO_ERROR);
 	if(retVal)
 	{
 		alBufferData (buffer[MusicGame], format, data, size, freq);
-		free(data);	
+		alutUnloadWAV(format,data,size,freq);
 	}
 	return retVal;
 #endif//USE_PLAYLIST
Index: chromium-0.9.12/src/AudioOpenAL.h
===================================================================
--- chromium-0.9.12.orig/src/AudioOpenAL.h	2001-03-20 16:11:07.000000000 +0100
+++ chromium-0.9.12/src/AudioOpenAL.h	2007-04-06 22:26:45.000000000 +0200
@@ -16,6 +16,7 @@
 #include <openal.h>
 #else //macintosh
 #include <AL/al.h>
+#include <AL/alut.h>
 #endif //macintosh
 
 /**
@@ -89,7 +90,7 @@
 	
 	float	origCDvolume;
 	
-	void	*context_id;
+	ALCcontext	*context_id;
 	bool	initialized;
 	float	audioScale[3];
 	
